#include <posix_thread.h>

PosixThread::PosixThread()
{
    pthread_mutexattr_t attr;
    pthread_mutexattr_init(&attr);
    pthread_mutex_init(&_mutex, &attr);
    _state = WAITING;
}


int PosixThread::lock()
{
    return pthread_mutex_lock(&_mutex);
}

int PosixThread::unlock()
{
    return pthread_mutex_unlock(&_mutex);
}

PosixThread::~PosixThread()
{
    pthread_mutex_destroy(&_mutex);
}

